home *** CD-ROM | disk | FTP | other *** search
- {$X+}
- program PickCopy;
-
- {This program provides an example of how to pop out of a dialog box, open
- a list box containing data from a file, then copy the desired data into
- several input lines in the input dialog box. The code to do this was
- written by Steve Schafer in response to a question by me.
-
- I have added code that reads, displays, adds to, edits, removes or prints
- data in collections, stored in ASCII files. This is modified from a demo
- program called Phone.pas available either on CIS or from Borland's BBS.
-
- I was unhappy with having the data stored in an object file since it would
- thus be unusable without this program and thus not be amenable to revision
- with a simple text editor. Having the data stored in an ASCII file rather
- with a stream file violates the principles of encapsulating data and code,
- but I love it!.
-
- Be aware that this example shows how Steven Schafer would do the pick and
- copy, but he says that there are certainly other ways which would work
- just as well.
-
- If you have comments or improvements, please send them along to me:
-
- Stewart Midwinter 74670,1306.
-
- Cheers, SAM }
-
- uses
- Memwatch, {warns of unreleased heap, by J.J. Stein}
- {available on CIS Pascal Library 1 }
- Drivers,Objects,Views,Menus, {Turbo Vision units }
- Dialogs,StdDlg,MsgBox,App, {Turbo Vision units }
- Gadgets, {Turbo Vision units }
- Dos,Crt, {standard Turbo Pascal units }
- SList; {handles editing collections }
-
-
- const
- cmNew = 101; { Initialise a new site file }
- cmOpen = 102; { Open an existing site file, read into memory }
- cmNewDialog = 103; { create Details-type dialog }
- cmSiteList = 201; { button to open list box to pick a site }
- cmListDlg = 107; { command to open list box dialog }
-
- { NumSites is the number of sites listed in the "Flight Details" dialog. }
-
- NumSites = 2;
-
- type
- PsiteApp = ^TsiteApp;
- TsiteApp = object (TApplication)
- CurrentFile: PathStr;
- HeapViewer: PHeapView;
- constructor Init;
- procedure NewsiteList;
- procedure OpensiteList;
- procedure SavesiteList;
- procedure HandleEvent (var Event: TEvent); virtual;
- procedure InitMenuBar; virtual;
- procedure InitStatusLine; virtual;
- procedure Idle; virtual;
- destructor Done; virtual;
- end;
-
- String80 = String[80];
- String60 = String[60];
- String40 = String[40];
- String14 = String[14];
-
- PSiteRec = ^TSiteRec;
- TSiteRec = record{object(TObject)}
- FNum: Word;
- FName: string40;
- FLat, FLong: String14;
- FInfo: String80;
- end;
-
- { TSite is an object type designed to hold all of the information for a
- site. It is a descendant of TObject so that we can store it in a
- collection. }
-
- PLSite = ^TLSite;
- TLSite = object(TObject)
- LName, LLat, LLong,LInfo: PString;
- constructor Init( AName: String40;
- ALat,ALong: String14;
- AInfo: String80);
- destructor Done; virtual;
- end;
-
- { TSiteCollection is a simple descendant of TSortedCollection, which
- assumes that the objects contained in it are all of type TSite. The only
- change is the new Compare method, which sorts the collection on the Name
- field of the TSites. }
-
- PLSiteCollection = ^TLSiteCollection; {contains a TLSite object}
- TLSiteCollection = object(TSortedCollection)
- function Compare (Key1,Key2: pointer): integer; virtual;
- procedure FreeItem(Item: pointer); virtual;
- end;
-
- { TSiteListBox is a list box which holds TSites. The GetText method knows
- that the items in the list box collection are TSites, so it extracts the
- Name field for display in the list box. }
-
- PLSiteListBox = ^TLSiteListBox;
- TLSiteListBox = Object(TListBox)
- function GetText (item: integer; MaxLen: integer): string; virtual;
- procedure HandleEvent(var Event: TEvent); virtual;
- end;
-
- PListDialog = ^TListDialog;
- TListDialog = object(TDialog)
- SitePicklist: PLSiteListBox;
- SiteType: PRadioButtons;
- constructor Init;
- end;
-
- { TSiteDialog is the "Flight Details" dialog box. Note that I've added
- fields corresponding to all of the input lines; this is so that they are
- directly accessible from HandleEvent. }
-
- PSiteDialog = ^TSiteDialog;
- TSiteDialog = object(TDialog)
- SSiteName,SSiteLat,SSiteLong: array[0..NumSites-1] of PInputline;
- constructor Init;
- procedure HandleEvent(var Event:TEvent); virtual;
- end;
-
- SCoordData = record
- SiteName: string80;
- SiteLat: String14;
- SiteLong: String14;
- end;
-
- DialogPtr = ^SDialogData;
- SDialogData = record {data record for inputting coordinates}
- PlaceData: array[0..1] of SCoordData;
- end;
-
- NamesArray = array[0..1] of string;
-
- const
- SiteDialogData:
- SDialogData = (PlaceData: (
- (SiteName: ''; SiteLat: '00'; SiteLong: '000'),
- (SiteName: ''; SiteLat: '00'; SiteLong: '000')
- ));
- ChosenLocn: NamesArray = ( 'Start point','Finish point');
-
- var
- siteApp: TsiteApp; {place here or CurrentFile will not be visible}
-
- var
- TheLSiteCollection: PLSiteCollection;
-
-
- { TsiteApp methods }
-
- constructor TsiteApp.Init;
- var R: TRect;
- begin
- TApplication.Init;
- RegisterObjects;
- RegisterViews;
- RegisterMenus;
- RegisterDialogs;
- RegisterApp;
- Registersite;
- GetExtent(R);
- Dec(R.B.X);
- R.A.X := R.B.X - 9; R.A.Y := R.B.Y - 1;
- HeapViewer := New(PHeapView,Init(R));
- Insert(HeapViewer);
- CurrentFile := '';
- Messagebox( #3'Test of Data Collection &'#13+
- #3'Input Dialog w/Pick List',nil,mfinformation+mfOkButton);
- end;
-
- procedure TSiteApp.Idle; {■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■}
- begin
- TApplication.Idle;
- HeapViewer^.Update;
- end;
-
-
- {----------------------------- TLSite -----------------------------------}
-
- { TLSite.Init just takes the string values passed to it and inserts them
- into the fields. Note that any blank strings are replaced with a single
- space. I've done this because calling NewStr ('') returns a NIL pointer,
- which can cause problems in protected mode. }
-
- constructor TLSite.Init (AName: String40; ALat,ALong: String14; AInfo: String80);
- begin
- TObject.Init;
- if AName <> '' then LName := NewStr (AName) else LName := NewStr (' ');
- if ALat <> '' then LLat := NewStr (ALat) else LLat := NewStr (' ');
- if ALong <> '' then LLong := NewStr (ALong) else LLong := NewStr (' ');
- if AInfo <> '' then LInfo := NewStr (AInfo) else LInfo := NewStr (' ');
- end;
-
- { TSite.Done simply releases the memory allocated in TSite.Init. }
-
- destructor TLSite.Done;
- begin
- DisposeStr (LName);
- DisposeStr (LLat);
- DisposeStr (LLong);
- DisposeStr (LInfo);
- TObject.Done;
- end;
- {------------------------------ end of TLSite ---------------------------}
-
- {---------------------------- TLSiteCollection --------------------------}
-
- { TSiteCollection.Compare extracts the Name fields from the two items and
- compares them alphabetically. }
-
- function TLSiteCollection.Compare (Key1,Key2: Pointer): Integer;
- begin
- if PLSite (Key1)^.LName^ < PLSite (Key2)^.LName^ then Compare := - 1
- else if PLSite (Key1)^.LName^ > PLSite (Key2)^.LName^ then Compare := 1
- else Compare := 0;
- end;
-
- procedure TLSiteCollection.FreeItem;
- begin
- if TheLSiteCollection <> nil then
- begin
- DisposeStr(PLSite(Item)^.LName);
- DisposeStr(PLSite(Item)^.LLat);
- DisposeStr(PLSite(Item)^.LLong);
- DisposeStr(PLSite(Item)^.LInfo);
- Dispose(PLSite(Item))
- end;
- end;
- {------------------------- end of TLSiteCollection ---------------------}
-
-
- { The FileExists function checks to see if the filename passed to it }
- { refers to an existing file. }
-
- function FileExists (FileName: PathStr): Boolean;
- var
- F: File;
- begin
- Assign (F,FileName);
- {$I-}
- Reset (F);
- {$I+}
- if IOResult <> 0 then FileExists := False
- else begin
- FileExists := True;
- Close (F);
- end;
- end;
-
- {--------------------------- SiteColl methods ---------------------------}
-
- { NewsiteList instantiates a new Tsitecoll object (empty), and invokes a
- dialog box via siteList^.Show, so that the user can enter information
- into the Tsitecoll. At the time the dialog is closed, the value returned
- by Show is checked. If the dialog was not closed with a cmCancel, the
- Tsitecoll is saved to disk. }
-
- procedure TsiteApp.NewsiteList;
- begin
- siteList := New (Psitecoll,Init (10,5));
- SiteList^.Duplicates:= true;
- SiteList^.Count:= 0;
- CurrentFile := '';
- if siteList^.Show <> cmCancel then SavesiteList else
- begin
- SiteList^.FreeAll;
- Dispose(ViewDialog,Done);
- Dispose(SiteList,Done);
- end;
- end;
-
- { OpensiteList is similar to NewsiteList, except that the Tsitecoll is
- loaded from an existing disk file. Error handling is rudimentary. }
-
- procedure Detrail(var T: String14); forward;
-
- procedure TsiteApp.OpensiteList;
- var
- LineOfFile: Pword;
- D: PFileDialog;
- S: String;
- P: PSite;
- F: text;
- FileSite: TSiteRec;
- begin
- D := New (PFileDialog,Init ('*.DAT','Open site file','~N~ame',
- fdOKButton + fdHelpButton,100));
- if Desktop^.ExecView (D) <> cmCancel then
- begin {Open a file}
- D^.GetFileName (CurrentFile);
- if FileExists (CurrentFile) then {open existing site file}
- begin
- SiteList := New (Psitecoll,Init (10,5));
- {have to init each time if reading from an ASCII file}
- {read items from file, insert into collection }
- SiteList^.Duplicates:= true;
- SiteList^.Count:= 0;
- Assign(F,CurrentFile);
- Reset(F);
- New(LineofFile);
- LineOfFile^ := 0;
- while not Eof(F) do
- begin
- Readln(F, S);
- Inc(LineOfFile^);
- if length(S) > 0 then
- begin
- with FileSite do
- begin
- FNum := LineofFile^;
- FName := copy(S, 1, (pos('/', S) - 1));
- if pos('/', S) <> 0 then System.Delete(S, 1, pos('/', S));
- FLat := copy(S, 1, (pos('/', S) - 1));
- if pos('/', S) <> 0 then System.Delete(S, 1, pos('/', S));
- Detrail(FLat);
- FLong := S;
- Detrail(FLong);
- Readln(F,S);
- FInfo := S;
- P := New (PSite,Init (FName,FLat,FLong,FInfo));
- SiteList^.Insert (P)
- end
- end
- end; {end While not EOF}
- Close(F);
- Dispose(LineOfFile);
-
- if siteList^.Show <> cmCancel then SaveSiteList else
- begin {display file contents in box}
- SiteList^.FreeAll;
- Dispose(SiteList,Done);
- Dispose(ViewDialog,Done);
- end;
- end {if CurrentFile <> ''}
- else
- begin
- MessageBox ('Can''t find ' + CurrentFile + '.',nil,
- mfError + mfOkButton);
- CurrentFile := '';
- end;
- end; {end if not cmCancel}
- Dispose (D,Done);
- end;
-
- { In this demo, SavesiteList is called only by NewsiteList or
- OpensiteList when it's time to save the currently active Tsitecoll
- object. If CurrentFile is null, SavesiteList opens a conventional file
- dialog; otherwise, the Tsitecoll is saved to CurrentFile. }
-
- procedure SaveRecords(SiteList: PSiteColl);
- var F: text;
-
- {note that this proc SaveAction is a FAR, LOCAL procedure; it is
- contained within SaveRecords, so it is local, yet must be declared FAR}
-
- procedure SaveAction ( P : PSite ) ; FAR ;
- begin
- with P^ do
- begin
- writeln (F, Name,'/', Latitude, '/',Longitude ) ;
- writeln (F, Info )
- end;
- end ;
-
- begin
- Assign (F,SiteApp.CurrentFile);
- {$I-} Rewrite (F); {$I+}
- if IOResult <> 0 then
- MessageBox( #3'Error saving to new file'#13+
- #3+SiteApp.CurrentFile,nil,mfError+mfOkButton);
- SiteList^.ForEach ( @SaveAction ) ;
- Close(F);
- end;
-
- procedure TsiteApp.SavesiteList;
- var
- D: PFileDialog;
- F: text;
- i: integer;
- begin
- if CurrentFile = '' then
- begin
- D := New (PFileDialog,Init ('*.DAT','Save site file','~N~ame',
- fdOKButton + fdHelpButton,100));
- if Desktop^.ExecView (D) <> cmCancel then D^.GetFileName (CurrentFile);
- Dispose (D,Done);
- end;
- SaveRecords(SiteList);
- SiteList^.FreeAll;
- Dispose(ViewDialog,Done);
- Dispose(SiteList,Done);
- end;
-
- procedure Detrail(var T: String14); {trim trailing blanks}
- begin
- while T[Length(T)] = ' ' do Dec(T[0])
- end;
-
- {------------------------ end of SiteColl methods -----------------------}
-
-
- {------------------------------- TSiteDialog ----------------------------}
-
- { TSiteDialog.Init is pretty much unchanged from your NewDialog
- procedure, except that the field names declared above are used to
- identify the various fields. }
-
- constructor TSiteDialog.Init;
- var
- R: TRect;
- begin
- R.Assign (10,2,65,18);
- TDialog.Init (R,'Flight Details');
- Options:= Options or ofCentered;
-
- R.Assign (3,8,18,9);
- SSiteName[0] := New (PInputLine,Init (R,60));
- Insert (SSiteName[0]);
- R.Assign (2,7,24,8);
- Insert (New (PLabel,Init (R,'Site 1',SSiteName[0])));
-
- R.Assign (22,8,32,9);
- SSiteLat[0] := New (PInputLine,Init (R,13));
- Insert (SSiteLat[0]);
- R.Assign (21,7,31,8);
- Insert (New (PLabel,Init (R,'Latitude',SSiteLat[0])));
-
- R.Assign (34,8,44,9);
- SSiteLong[0] := New (PInputLine,Init (R,13));
- Insert (SSiteLong[0]);
- R.Assign (33,7,43,8);
- Insert (New (PLabel,Init (R,'Longitude',SSiteLong[0])));
-
- R.Assign (3,11,18,12);
- SSiteName[1] := New (PInputLine,Init (R,60));
- Insert (SSiteName[1]);
- R.Assign (2,10,24,11);
- Insert (New (PLabel,Init (R,'Site 2',SSiteName[1])));
-
- R.Assign (22,11,32,12);
- SSiteLat[1] := New (PInputLine,Init (R,13));
- Insert (SSiteLat[1]);
- R.Assign (21,10,31,11);
- Insert (New (PLabel,Init (R,'Latitude',SSiteLat[1])));
-
- R.Assign (34,11,44,12);
- SSiteLong[1] := New (PInputLine,Init (R,13));
- Insert (SSiteLong[1]);
- R.Assign (33,10,43,11);
- Insert (New (PLabel,Init (R,'Longitude',SSiteLong[1])));
-
- R.Assign (3,2,10,4);
- Insert (New (PButton,Init (R,'~O~k',cmOk,bfDefault)));
- R.Assign (12,2,22,4);
- Insert (New (PButton,Init(R,'Cancel',cmCancel,bfNormal)));
- R.Assign (24,2,37,4);
- Insert (New (PButton,Init(R,'Site List',cmSiteList,bfNormal)));
- end; {NewDialog}
-
-
- { The only event which TSiteInfoDialog.HandleEvent handles specially is the
- cmSiteList event. }
-
- procedure TSiteDialog.HandleEvent (var Event: TEvent);
- var
- ListDialog: PListDialog;
- SiteNum: Word;
- LSite: PLSite;
- begin
- TDialog.HandleEvent (Event);
- if SiteApp.CurrentFile = ''
- then begin EnableCommands([cmOk,cmCancel]); {don't pop open the list}
- DisableCommands([cmSiteList]); {unless there is one to }
- end {read from CurrentFile }
- else EnableCommands([cmOk,cmCancel,cmSiteList]);
-
- if Event.What = evCommand then
- begin
- case Event.Command of
- cmSiteList:
- if SiteApp.CurrentFile <> '' then
- begin
-
- { Create a new list dialog box. }
-
- ListDialog := New (PListDialog,Init);
-
- { ExecView it and check the value returned. If the list dialog box was
- closed by the user pressing the OK button, we have more work to do. }
-
- if Desktop^.ExecView (ListDialog) = cmOK then
- begin
-
- { Note that, although the list dialog box has finished executing at this
- point, and is no longer visible on the screen, we haven't disposed of
- it yet, so we can still get the information out of it, such as which
- item in the list box is selected, etc. }
-
- { The radio button cluster (SiteType) holds the information telling us which
- site we'll be assigning values to. }
-
- SiteNum := ListDialog^.SiteType^.Value;
-
- with ListDialog^.SitePicklist^ do
- begin
-
- { Get a pointer to the selected site in the list box. }
-
- LSite := PLSite (List^.At (Focused));
-
- { Copy the data from the TLSite in the list box to the appropriate input
- lines. }
-
- SSiteName[SiteNum]^.Data^ := LSite^.LName^;
- SSiteLat[SiteNum]^.Data^ := LSite^.LLat^;
- SSiteLong[SiteNum]^.Data^ := LSite^.LLong^;
- end;
-
- { Refresh the screen display with the new values. }
-
- SSiteName[SiteNum]^.DrawView;
- SSiteLat[SiteNum]^.DrawView;
- SSiteLong[SiteNum]^.DrawView;
- end;
-
- { We're done with the list dialog box at this point, so we can get rid of it. }
-
- if TheLSiteCollection <> nil then
- begin
- TheLSiteCollection^.FreeAll;
- end;
- if ListDialog <> nil then Dispose (ListDialog,Done);
- end; {end of cmSiteDialog}
- end; {end case}
- end;
- ClearEvent(Event);
- end;
- {------------------------ end of TSiteDialog ----------------------------}
-
- {------------------------ ListDialog & Listbox --------------------------}
-
- function CreateList: PLSiteCollection; {was string}
- var
- F: Text;
- S: String;
- List: PLSiteCollection;
- FileSite: TSiteRec;
- LineOfFile: Pword;
- begin
- List := New(PLSiteCollection, Init(50, 25));
- List^.Duplicates:= true;
- Assign(F, SiteApp.CurrentFile);
- {$I-} Reset(F); {$I+}
- if IOResult <> 0 then
- MessageBox( #3'Error reading from site file'#13+
- #3+SiteApp.CurrentFile,nil,mfError+mfOkButton);
- New(LineOfFile);
- LineOfFile^ := 0;
- while not Eof(F) do
- begin
- Readln(F, S);
- Inc(LineOfFile^);
- if length(S) > 0 then
- begin
- with FileSite {SiteData[LineOfFile^]} do
- begin
- FNum := LineOfFile^;
- FName := copy(S, 1, (pos('/', S) - 1)); Delete(S, 1, pos('/', S));
- FLat := copy(S, 1, (pos('/', S) - 1)); Delete(S, 1, pos('/', S));
- Detrail(FLat);
- FLong := S;
- Detrail(FLong);
- Readln(F,S);
- FInfo := S;
- List^.Insert(New(PLSite,Init (FName,FLat,FLong,FInfo)))
- end
- end
- end;
- Close(F);
- Dispose(LineOfFile);
- CreateList := List;
- end; {function CreateList}
-
- { TSiteListBox.GetText knows that the list box contains items of type TSite,
- so it extracts the Name field from the item. }
-
- function TLSiteListBox.GetText (Item: Integer; MaxLen: Integer): String;
-
- begin
- GetText := Copy (PLSite (List^.At (Item))^.LName^,1,MaxLen);
- end;
-
-
- { Draw the dialog, listbox, and buttons for the list dialog box. }
- { TListDialog.Init is pretty much the same as your ListDlg procedure. }
-
- constructor TListDialog.Init;
- var
- R: TRect;
- Scroll: PScrollBar;
- begin
- R.Assign (10,1,60,22);
- TDialog.Init (R,'List');
- R.Assign (47,2,48,10);
- Scroll := New (PScrollBar,Init (R));
- Insert (Scroll);
- R.Assign (2,2,47,10);
- SitePicklist := New (PLSiteListBox,Init (R,1,Scroll));
- Insert (SitePicklist);
- R.Assign (1,1,46,2);
- Insert (New (PLabel,Init(R,'~S~ites in file ' + SiteApp.CurrentFile,SitePicklist)));
- R.Assign (5,13,31,17);
- SiteType := New (PRadioButtons,Init (R,
- NewSItem ('Start point',
- NewSItem ('Finish point',
- nil))));
- Insert (SiteType);
- R.Assign (4,12,31,13);
- Insert (New (PLabel,Init (R,'~D~estination for site data:',SiteType)));
- R.Assign (4,18,16,20);
- Insert (New (PButton,Init (R,'Cancel',cmCancel,bfNormal)));
- R.Assign (24,18,36,20);
- Insert (New (PButton,Init (R,'~O~K',cmOK,bfDefault)));
-
- { This is the way to attach a new collection to the list box. Note that
- the disk file will be re-read every time the list dialog box is opened.
- Whether this is desirable or not depends on the application. Another
- technique would be to call CreateList only once, at the start of the
- application, and store its results in a global variable (call it TheList).
- Then you'd just do a SitePicklist^.NewList (TheList) here. }
-
- SitePicklist^.NewList (CreateList);
- end;
-
- { TSiteListBox.HandleEvent responds to a double-click on an item in the
- list box by (1) selecting that item, and (2) shoving a cmOK command into
- the event queue, to simulate the user pressing the OK button. That way,
- double-clicking ends up having the same effect as single-clicking the item
- followed by pressing the OK button. }
-
- procedure TLSiteListBox.HandleEvent (var Event: TEvent);
- begin
- if Event.What = evMouseDown then if Event.Double then
- begin
- Event.What := evCommand;
- Event.Command := cmOK;
- Event.InfoPtr := @Self;
- PutEvent (Event);
- ClearEvent (Event);
- end;
- TListbox.HandleEvent(Event);
- end;
- {--------------------- end of ListDialog & Listbox ---------------------}
-
- {--------------------- Main application procedures ---------------------}
- { This is the key to the pick and copy. Note that the the input dialog
- is created from the Application's handleEvent, and the List dialog is
- created by the input dialog's handleEvent, and the listbox is created
- by the list dialog's handleEvent. As each box closes, it returns
- control automatically to the previous handleEvent. This saves a more
- complicated arrangement of broadcast messages (which I tried but was
- unable to get working properly: control always ended up in the wrong
- place after all the dialog boxes were closed -- SM }
-
- procedure TsiteApp.HandleEvent (var Event: TEvent);
- var
- C: word;
- SiteDialog: PSiteDialog;
- S: string;
- begin
- TApplication.HandleEvent (Event);
- if Event.What = evCommand then
- begin
- case Event.Command of
- cmNew: NewsiteList;
- cmOpen: OpensiteList;
- cmNewDialog:
- begin
- SiteDialog := New (PSiteDialog, Init);
- SiteDialog^.SetData(SiteDialogData);
- C:=Desktop^.Execview(SiteDialog);
- if C <> cmCancel then SiteDialog^.GetData(SiteDialogData);
-
- {your processing of the input data would go here}
-
- if SiteDialog <> nil then Dispose(SiteDialog,done);
- end;
- else Exit;
- end;
- ClearEvent(Event);
- end;
- end;
-
- procedure TsiteApp.InitMenuBar;
- var
- R: TRect;
- begin
- GetExtent (R);
- R.B.Y := R.A.Y + 1;
- MenuBar := New (PMenuBar,Init (R,NewMenu (
- NewSubMenu ('~F~ile',hcNoContext,NewMenu (
- NewItem ('~N~ew Site list','F3',kbF3,cmNew,hcNoContext,
- NewItem ('~O~pen Site file...','F5',kbF5,cmOpen,hcNoContext,
- NewLine (
- NewItem ('~N~ew Dialog','',kbNoKey,cmNewDialog,hcNoContext,
- NewLine (
- NewItem ('E~x~it','Alt-X',kbAltX,cmQuit,hcNoContext,nil))))))),nil))));
- end;
-
- procedure TsiteApp.InitStatusLine;
- var
- R: TRect;
- begin
- GetExtent (R);
- R.A.Y := R.B.Y - 1;
- StatusLine := New (PStatusLine,Init (R,
- NewStatusDef (0,$FFFF,
- NewStatusKey ('~F3~ New',kbF3,cmNew,
- NewStatusKey ('~F5~ Open',kbF5,cmOpen,
- NewStatusKey ('~Alt-X~ Exit',kbAltX,cmQuit,
- NewStatusKey ('',kbF10,cmMenu,nil)))),nil)));
- end;
-
- destructor TSiteApp.Done; {■■■■■■■■■■■■■■■■■■■■■■■■■}
- var
- Event: TEvent;
- begin {de-allocate memory in reverse order to allocation}
- Dispose(HeapViewer,Done);
- TApplication.Done;
- end; {I was unable to clear all the heap memory;}
- {if you can figure it out, let me know! -SM}
-
- begin
- siteApp.Init;
- siteApp.Run;
- siteApp.Done;
- end.
-
-